<template>
    <el-container class="full-contatiner">
      <el-aside width="150px" class="active">
        <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            background-color="#dbe7e3"
            text-color="#333"
            active-text-color="#fff">
          <el-menu-item index="1">
            <router-link to='/home' tag="span">首页</router-link>
            </el-menu-item>
          <el-submenu index="2">
            <template slot="title">
              <span>系统用户</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/home/user" tag="span">用户管理</router-link>
              </el-menu-item>
              <el-menu-item index="1-2">
                <router-link to="/home/lll" tag="span">角色管理</router-link>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-menu-item index="3">
            <router-link to="/home/lll" tag="span">系统设置</router-link>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          用户：{{username}}
          <el-button type="danger" plain size="mini" @click="quit">退出登录</el-button>
        </el-header>
        <el-main>
          <router-view class="view"/>
        </el-main>
      </el-container>
    </el-container>
</template>

<script>
import axios from "axios";

export default {
  name: "Home",
  data(){
    return {
      username : this.$store.state.username
    }
  },
  methods:{
    quit(){
      this.$store.state.username = ''
      this.$store.state.token = ''
      this.$router.push('/')
      axios.get('/user/quit').then(res=>{
        console.log(res)
      })
    }
  }
}
</script>

<style>


.active{
  height: 900px;
}
.el-header, .el-footer {
  background-color: #7fb97a;
  color: #333;
  text-align:right;
  line-height: 60px;
}

.el-aside {
  background-color: #dbe7e3;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #E9EEF3;
  color: #333;
}

</style>